//  采购计划列表 api

import { ajaxService } from '@/utils/request';

const env = import.meta.env;
let baseURL = env.VITE_BUY_URL;
// 获取表头设置
export function getPurchaseHeader(params: any) {
  return ajaxService({
    url: '/purchase/list/header/get',
    params,
    method: 'get',
    baseURL,
  });
}

// 修改表头设置
export function PUTPurchaseHeader(data: any) {
  return ajaxService({
    url: '/purchase/list/header/edit',
    data,
    method: 'put',
    baseURL,
  });
}

// 获取列表数据
export function getPurchasePlanList(params: any) {
  return ajaxService({
    url: '/purchase/list/plan/getAll',
    params,
    method: 'get',
    baseURL,
  });
}

// 获取列表数据
export function getPurchasePlanDetail(params: any) {
  return ajaxService({
    url: '/purchase/list/plan/get',
    params,
    method: 'get',
    baseURL,
  });
}

// 删除列表数据
export function delPurchasePlanList(data: any) {
  return ajaxService({
    url: '/purchase/list/plan/del',
    data,
    method: 'delete',
    baseURL,
  });
}

// 新增计划
export function postPurchasePlanList(data: any) {
  return ajaxService({
    url: '/purchase/list/plan/add',
    data,
    method: 'post',
    baseURL,
  });
}

// 新增计划产品
export function postPlanPurchase(data: any) {
  return ajaxService({
    url: '/purchase/list/plan/product',
    data,
    method: 'post',
    baseURL,
  });
}

// 修改计划产品
export function putPlanPurchase(data: any) {
  return ajaxService({
    url: '/purchase/list/plan/product',
    data,
    method: 'put',
    baseURL,
  });
}

// 删除计划产品
export function delPlanPurchase(data: any) {
  return ajaxService({
    url: '/purchase/list/plan/product',
    data,
    method: 'delete',
    baseURL,
  });
}

// 编辑计划
export function putPlanPurchaseList(data: any) {
  return ajaxService({
    url: '/purchase/list/plan',
    data,
    method: 'put',
    baseURL,
  });
}
